@barPageSize: 3rem;

.ub-bar-page {
    position: fixed;
    right: 1rem;
    bottom: 2rem;
    z-index: 10000;
    background: #FFF;
    border-radius: 0.5rem;
    box-shadow: 0 0 20px 0 rgba(0, 0, 0, .08);

    &.close {
        right: 0px;
        bottom: 1rem;

        .items {
            display: none;
        }

        .item-top {
            display: none;
        }

        .bar-page-close {
            display: none;
        }

        .bar-page-show {
            display: block;
        }
    }

    .bar-page-show {
        border: 1px solid var(--color-primary);
        background-color: var(--color-content-bg);
        color: var(--color-primary);
        width: 24px;
        border-radius: 5px 0 0 5px;
        line-height: 18px;
        text-align: center;
        cursor: pointer;
        font-size: 12px;
        display: none;
    }

    .bar-page-close {
        border: 1px solid var(--color-primary);
        background-color: transparent;
        position: absolute;
        color: var(--color-primary);
        width: 24px;
        height: 24px;
        border-radius: 50%;
        line-height: 22px;
        font-size: 16px;
        text-align: center;
        right: 22px;
        bottom: -29px;
        cursor: pointer;
        display: block;
    }

    .items {
        .item {
            width: @barPageSize + 0.5rem;
            height: @barPageSize + 0.5rem;
            display: block;
            color: var(--color-primary);
            text-align: center;
            padding: 0.5rem;
            position: relative;
            cursor: pointer;
            transition: background-color 0.5s;
            background: #FFFFFF;

            &:first-child {
                border-top-left-radius: 0.5rem;
                border-top-right-radius: 0.5rem;
            }

            &:last-child {
                border-bottom-left-radius: 0.5rem;
                border-bottom-right-radius: 0.5rem;
            }


            &:hover {
                .popup {
                    display: block;
                }
            }

            .popup {
                position: absolute;
                right: @barPageSize + 0.5rem;
                bottom: 0;
                background: #FFF;
                border-radius: 0.5rem;
                box-shadow: 0 0 20px 0 rgba(0, 0, 0, .08);
                width: 10rem;
                min-height: 2rem;
                padding: 0.5rem;
                display: none;

                .content {
                    color: #333;

                    img {
                        width: 9rem;
                    }
                }
            }

            &:hover {
                background: var(--color-primary-light-bg);
                transition: background 0.5s;
            }

            &.item-icon {
                .icon {
                    line-height: 2rem;
                    height: 2rem;
                }
            }

            .icon {
                height: 1.5rem;
                line-height: 1.5rem;
                font-size: 1.5rem;
                display: block;
            }

            .text {
                height: 0.5rem;
                line-height: 0.5rem;
                display: block;
                font-size: 0.5rem;
            }
        }
    }

    .item-top {
        width: @barPageSize + 0.5rem;
        height: @barPageSize + 0.5rem;
        display: block;
        background: transparent;
        cursor: pointer;
        border: 0.1rem solid var(--color-primary);
        border-radius: 50%;
        position: absolute;
        top: 0 - @barPageSize - 1rem;

        .cover {
            width: @barPageSize + 0.3rem;
            height: @barPageSize + .3rem;
            border: 1px solid var(--color-primary);
            border-radius: 50%;
            animation: 3s ease-in-out 0s infinite avatarScaling;

            .avatar {
                width: 100%;
                height: 100%;
                background-size: cover;
                border-radius: 50%;
            }
        }

        &:hover {
            .popup {
                display: block;
            }
        }

        .popup {
            position: absolute;
            right: @barPageSize + 0.5rem;
            top: 0;
            background: #FFF;
            border-radius: 0.5rem;
            box-shadow: 0 0 20px 0 rgba(0, 0, 0, .08);
            width: 10rem;
            min-height: 2rem;
            padding: 0.5rem;
            display: none;

            .content {
                color: #333;

                img {
                    width: 9rem;
                }
            }
        }
    }

    @keyframes avatarScaling {
        0% {
            transform: scale(1);
        }
        25% {
            transform: scale(0.8);
        }
        50% {
            transform: scale(1);
        }
        75% {
            transform: scale(0.8);
        }
    }

}


.ub-bar-page {
    .item-back {
        color: #999;
        pointer-events: none;
    }
}

html.body-scroll-far {
    .ub-bar-page {
        .item-back {
            color: var(--color-primary);
            pointer-events: all;
        }
    }
}

@media (max-width: 40rem) {
    .ub-bar-page {
        bottom: 2rem;
        width: 2rem;

        &.close {
            width: auto;
        }

        .bar-page-close {
            right: 9px;
        }

        .items {
            .item {
                width: 2rem;
                height: 2rem;
                padding: 0.25rem 0;

                .popup {
                    right: 2.25rem;
                }

                .icon {
                    font-size: 1rem;
                    line-height: 1rem;
                    height: 1rem;
                }

                .text {
                    font-size: 0.4rem;
                }
            }

            .item-icon {
                padding: 0;
            }
        }

        .item-top {
            top: -2.5rem;
            width: 2rem;
            height: 2rem;
            border-width: 0.1rem;

            .cover {
                width: 1.8rem;
                height: 1.8rem;
            }

            .popup {
                right: 2.25rem;
                top: initial;
                bottom: 0;
            }
        }
    }
}

